package com.huawei.admins.platform.gateway.core.component.router.parser;

import com.huawei.admins.platform.gateway.core.component.router.RouteDefinition;
import com.huawei.admins.platform.gateway.core.component.router.RouteDefinitionLocator;
import com.huawei.admins.platform.gateway.core.config.GatewayProperties;
import reactor.core.publisher.Flux;

public class PropertiesRouteDefinitionLocator implements RouteDefinitionLocator {

    private final GatewayProperties properties;

    public PropertiesRouteDefinitionLocator(GatewayProperties properties) {
        this.properties = properties;
    }

    @Override
    public Flux<RouteDefinition> getRouteDefinitions() {
        return Flux.fromIterable(this.properties.getRoutes());
    }
}
